<?php
// +----------------------------------------------------------------------
// | ThinkPHP [ WE CAN DO IT JUST THINK ]
// +----------------------------------------------------------------------
// | Copyright (c) 2006~2018 http://thinkphp.cn All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: liu21st <liu21st@gmail.com>
// +----------------------------------------------------------------------
use think\facade\Route;

//登录
Route::post('login','Login/doLogin');

Route::post('get_xcx_token', 'User/getXcxToken');   //小程序获取用户token
Route::post('token_verify', 'User/tokenVerify');

Route::group('admin',function (){

    /**
     * 菜单
     */
    //获取菜单权限
    Route::get('permission', 'Menu/menuPermission');
    //菜单
    Route::get('menu_list', 'Menu/MenuInfo');
    //新增and编辑
    Route::post('menuSave', 'Menu/MenuSave');
    //删除菜单
    Route::get('menuDel/:id', 'Menu/MenuDel');
    //添加子菜单
    Route::post('child_save', 'Menu/childSave');
    //获取菜单类别
    Route::get('menuType', 'Menu/MenuType');

    /**
     * 用户
     */
    //获取用户信息
    Route::get('admin_show', 'Login/adminShow');
    //用户列表
    Route::get('user_list', 'Admin/userList');
    //用户更新
    Route::get('update_show/:id', 'Admin/userUpdateShow');
    //用户保存
    Route::post('user_save', 'Admin/userSave');
    //删除用户
    Route::get('user_delete/:id', 'Admin/userDelete');

    /**
     * 角色
     */
    //获取角色列表 代树
    Route::get('role_list', 'Role/roleList');
    //读取所有角色
    Route::get('role_info_list', 'Role/roleInfoList');
    //保存中间表角色
    Route::post('set_role_user_pivot', 'Role/setRoleUserPivot');
    //新增and编辑角色
    Route::post('save_role', 'Role/saveRole');
    //更改角色状态
    Route::put('update_role_status/:id/:status', 'Role/updateRoleStatus');
    //删除角色
    Route::delete('del_role/:id/:role_id', 'Role/delRole');
    //删除角色组
    Route::delete('del_group/:id', 'Role/groupDel');

    /**
     * 项目
     */
    //保存项目
    Route::post('save_project', 'Project/saveProject');
    //项目列表
    Route::get('project_list', 'Project/projectList');
    //根据项目id读取唯一
    Route::get('read_project/:id', 'Project/projectRead');
    //删除项目
    Route::delete('del_project/:id', 'Project/projectDel');
    Route::get('change_project/:id', 'Project/projectChange');


    //指标
    Route::post('upload_target', 'Target/uploadTarget');
    Route::post('save_file', 'Target/saveFile');

    /**
     * 同步项目
     */
    //同步案件
    Route::post('sync_project_case', 'Project/syncProjectCase');


    //项目指标
    Route::post('save_project_target', 'Project/saveProjectTarget');
    //列表
    Route::get('project_target_list', 'Project/getProjectTargetList');
    //删除
    Route::delete('del_project_target/:id', 'Project/delProjectTarget');

    Route::get('get_project_target_type', 'Project/getProjectTargetType');

    //获取样本点
    Route::get('get_sample_list', 'Sample/getSampleList');
    Route::post('save_allot_community', 'Sample/saveAllotCommunity');
    //删除样本点
    Route::delete('del_sample/:id', 'Sample/delSample');

    /**
     * 社区
     */
    //列表
    Route::get('community_list', 'Community/getCommunityList');
    //保存
    Route::post('save_community', 'Community/saveCommunity');
    //更改社区状态
    Route::post('set_community_status', 'Community/setCommunityStatus');
    //获取唯一信息
    Route::get('read_community/:id', 'Community/communityRead');
    //分配社区时select读取
    Route::get('get_select_type', 'Community/getSelectTypeComm');
    //删除
    Route::get('community_delete/:id', 'Community/communityDelete');
    //导入
    Route::post('import_excel', 'Community/importExcel');
    //下载数据模板文件
    Route::get('download_file', 'Community/downloadFile');
    /**
     *
     * 案件
     */
    //查看案件图片
    Route::get('check_img/:id', 'ReviewCase/checkImage');
    //案件列表
    Route::get('review_case_list', 'ReviewCase/getReviewCaseList');

    //获取复查状态
    Route::get('review_status', 'ReviewCase/getReviewStatus');
    //审核状态
    Route::get('audit_status', 'ReviewCase/getAuditStatus');
    //审核结果
    Route::get('audit_result', 'ReviewCase/getAuditResult');
    //搜索项目
    Route::get('search_project', 'ReviewCase/getSearchProject');
    //根据项目id获取对应的样本点
    Route::get('search_sample/:id', 'ReviewCase/getSearchSample');
    //获取社区
    Route::get('search_community', 'ReviewCase/getSearchCommunity');
    //根据id获取案件
    Route::get('read_case/:id', 'ReviewCase/getReadCase');
    //保存案件审核结果
    Route::post('save_audit_result', 'ReviewCase/saveAuditResult');
    //新增复查案件
    Route::post('save_review_case', 'ReviewCase/saveReviewCase');
    Route::post('save_edit_review_case', 'ReviewCase/saveEditReviewCase');

    //删除案件
    Route::get('del_case/:id', 'ReviewCase/delCase');

    //上传案件图片
    Route::post('update_img_url', 'ReviewCase/updateImgUrl');

    //系统设置
    //保存轮播图
    Route::post('save_carousel', 'System/saveCarouselFile');
    //读取
    Route::get('get_carousel_list', 'System/getCarouselList');

    //删除
    Route::delete('carousel_del/:id', 'System/DelCarousel');

    //公告
    Route::post('save_notice', 'System/saveNotice');
    //读取
    Route::get('get_notice_list', 'System/getNoticeList');
    //删除
    Route::delete('notice_del/:id', 'System/DelNotice');

    Route::get('get_target_list', 'Target/getTargetList');
    Route::delete('target_del/:id', 'Target/DelTarget');


    //统计
    //个人
    Route::get('get_personal_list', 'Statistics/personalStatisticsList');
    //社区
    Route::get('get_community_list', 'Statistics/communityStatisticsList');



})->middleware(\app\middleware\CheckAuth::class);


Route::group('wx',function (){
    //案件列表
    Route::get('review_case_wx_list', 'ReviewCase/getReviewCaseWxList');
    Route::get('read_case_wx', 'ReviewCase/getReadCaseWx');
    Route::post('update_img_url', 'ReviewCase/updateImgUrl');
    Route::post('save_wx_review_case', 'ReviewCase/saveWxReviewCase');

    Route::get('search_community', 'ReviewCase/getSearchCommunity');

    Route::post('get_sms_code','ReviewCase/getSmsCode');

    Route::post('save_user_wx','ReviewCase/getSmsCode');

    Route::post('wx_login','User/wxLogin');


    Route::post('update_user_head_img','User/updateUserHeaderImg');

    Route::post('save_user_info','User/saveUserInfo');

    //个人
    Route::get('get_personal_list', 'Statistics/personalStatisticsList');
    //社区
    Route::get('get_community_list', 'Statistics/communityStatisticsList');


})->middleware(\app\middleware\wxAuthMiddleware::class);
//轮播图
Route::get('get_carousel_list', 'System/getCarouselList');
//指标
Route::get('get_target_list', 'Target/getTargetList');
//读取
Route::get('get_notice_list', 'System/getNoticeList');

Route::post('bind_client_uid','User/bindClientUid');
//微信登录
Route::post('verify_user','User/verifyUser');
